<?php
/*
 +----------------------------------------------------------------------
 + Title        : LogController 控制器
 + Author       : Randy_chen
 + Version      : V1.0.0.1
 + Initial-Time : 2023/12/23 7:49
 + Last-time    : 2023/12/23 7:49+ chen2
 + Desc         : LogController
 +----------------------------------------------------------------------
*/


namespace app\api\controller\common;

use app\admin\model\AdminMenu;
use app\BaseController;
use app\common\model\Log;
use app\http\middleware\AddLog;
use app\http\middleware\Auth;
use app\http\middleware\ValidateParams;
use think\annotation\Inject;

class LogController extends BaseController
{
    protected $middleware = [];

    #[Inject]
    protected Log $model;

    public function index()
    {
        $data = $this->getParams();
        //当前是否为关联查询
        //设置过滤方法
        $extendQueryHelper = $this->buildparams();

        $query = Log::build()
                          ->where($extendQueryHelper->where)
                          ->order($extendQueryHelper->sort, $extendQueryHelper->order);
        if (!empty($params['trade_id'])) {
            $query->orderByDesc('create_time');
        }

        $list = $query->_paginate();
        foreach ($list as $row) {

        }
        return $this->returnSuccess($list);
    }
}